import Vue from 'vue'
// import Vuex from 'vuex'
import Login from '@/views/Login'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
// 首页
import Home from '../views/Layout/Home/index.vue'
// 我的
import User from '../views/Layout/User/index.vue'
// import ArticleItem from '../views/Layout/Home/components/Articleltem.vue'
import Search from '@/views/Search'
import SearchResult from '@/views/Search/SearchResult'
import ArticleDetail from '@/views/Article/id'
import UserEdit from '@/views/UserEdit'
// import { component } from 'vue/types/umd'
import Chat from '@/views/Chat'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    redirect: '/layout'
  }, {
    path: '/login',
    component: Login
  }, {
    path: '/search',
    component: Search
  },
  // 二级路由
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      }, {
        path: 'user',
        component: User
      }
    ]
  }, {
    path: '/search/:keywords',
    component: SearchResult
  }, {
    path: '/article',
    component: ArticleDetail
  }, {
    path: '/useredit',
    component: UserEdit
  }, {
    path: '/chat',
    component: Chat
  }
]
const router = new VueRouter({
  routes
})
export default router
